<?php
class BoardsForm extends Zend_Form {
    public function __construct($options = null) 
    {
    	$baseurl 	= new MHDEV_View_Helper_BaseUrl();
    	$translate	= Zend_Registry::get('lang');
    	
        parent::__construct($options);
        
        $this->setName('boards');

        // Title
        $title = new Zend_Form_Element_Text('title');
        $title->setLabel($translate->_('form_boards_title'));
        $title->setRequired(true);
        $title->addValidator('NotEmpty');
        $title->setErrorMessages(array(
            0 => $translate->_('error_boards_title')
        ));
        
        // Text
        $text = new Zend_Form_Element_Textarea('desc');
		$text->setLabel($translate->_('form_boards_desc'));
		$text->setRequired(true);
		$text->addFilter('StringTrim');
		$text->addValidator('NotEmpty');
		$text->setAttrib('rows','5');
		$text->setAttrib('cols','30');
		$text->setErrorMessages(array(
            0 => $translate->_('error_boards_desc')
        ));
        
        // category
		$category = new Zend_Form_Element_Select('category_uid');
		$category->setLabel($translate->_('form_boards_cat'));
		$category->setDescription($translate->_('form_boards_dcat'));
		$category->setRequired(true);
		$category->setErrorMessages(array(
			0 => $translate->_('error_boards_cat')
		));
		
		// groups
		$groups = new Zend_Form_Element_Select('group_uid');
		$groups->setLabel($translate->_('form_boards_groups'));
		$groups->setDescription($translate->_('form_boards_dgroups'));
		$groups->setRequired(true);
		$groups->setErrorMessages(array(
			0 => $translate->_('error_boards_groups')
		));
		
		// sub_board
		$root_uid = new Zend_Form_Element_Select('root_uid');
		$root_uid->setLabel($translate->_('form_boards_root'));
		$root_uid->setDescription($translate->_('form_boards_droot'));
		$root_uid->addMultiOption('#', $translate->_('form_choose'));
		
		// allow guests
		$allow_guests = new Zend_Form_Element_Checkbox('allow_guests');
		$allow_guests->setLabel($translate->_('form_boards_guests'));
		$allow_guests->setDescription($translate->_('form_boards_dguests'));
		
		// allow guest posts
		$allow_guests_posts = new Zend_Form_Element_Checkbox('allow_guest_posts');
		$allow_guests_posts->setLabel($translate->_('form_boards_posts'));
		$allow_guests_posts->setDescription($translate->_('form_boards_dposts'));
		
		// allow guest threads
		$allow_guests_threads = new Zend_Form_Element_Checkbox('allow_guest_threads');
		$allow_guests_threads->setLabel($translate->_('form_boards_threads'));
		$allow_guests_threads->setDescription($translate->_('form_boards_dthreads'));
		
		// sort_uid
		$sort_uid = new Zend_Form_Element_Text('sort_uid');
		$sort_uid->setLabel($translate->_('form_boards_sort'));
		$sort_uid->setDescription($translate->_('form_boards_dsort'));
		
		// hidden
		$hidden = new Zend_Form_Element_Checkbox('is_hidden');
		$hidden->setLabel($translate->_('form_boards_hidden'));
		$hidden->setDescription($translate->_('form_boards_dhidden'));
		
		// is public
		$public = new Zend_Form_Element_Checkbox('is_public');
		$public->setLabel($translate->_('form_boards_public'));
		$public->setDescription($translate->_('form_boards_dpublic'));
		
		// dump
		$dump = new Zend_Form_Element_Checkbox('dump');
		$dump->setLabel($translate->_('form_boards_dump'));
		$dump->setDescription($translate->_('form_boards_ddump'));
		
		// delete
		$delete = new Zend_Form_Element_Checkbox('is_deleted');
		$delete->setLabel($translate->_('form_boards_delete'));
		$delete->setDescription($translate->_('form_boards_ddelete'));
		
        // Submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($translate->_('form_save'));
        
        $this->addElements(array($title, $text, $category, $root_uid, $groups, $allow_guests, $allow_guests_posts, $allow_guests_threads, $sort_uid, $public, $hidden, $dump, $delete, $submit));
    }
}  
?>